package com.ricky.game;

import java.util.HashMap;
import java.util.Map;

import com.ricky.game.scene.RoomController;

public class MsgComressionHelper {

	
	/**
	 * 英雄所有信息
	 * @param req
	 * @param data
	 */
	public static Map<String,Object>  heroDataMsg(Hero hero)
	{
		Map<String,Object> msg=hero.getAttributeObject();
		msg.put("name", hero.getName());
		return msg;
	}
	
	/**
	 * 英雄的指导属性
	 * @param hero
	 * @param key
	 * @return
	 */
	public static Object heroAttMsg(Hero hero,String key)
	{
		Map<String,Object> msg=new HashMap<String,Object>();
		msg.put("name", hero.getName());
		msg.put(key, hero.getAttribute(key));//玩家指定信息
		return msg;
	}
	
	/**
	 * 房间广播信息
	 * @param room
	 * @return
	 */
	public static Map<String,Object> roomInfo(RoomController room)
	{
		Map<String,Object> info=new HashMap<String,Object>();
		info.put("id", room.getId());
		info.put("name", room.getName());
		info.put("createName", room.getCreator().getUserName());
		info.put("info", room.getSceneInfo());
		return info;
	}
}
